Package com.cisco.pt.mu
Class MUSessionImpl
java.lang.Object
java.lang.Thread
com.cisco.pt.mu.MUSessionImpl
- All Implemented Interfaces:
PacketTracerSession,Runnable
- Author:
- tdeng
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected KeepAliveTaskprotected KeepAliveExpireNotifierprotected Stringprotected MuEventManagerprotected LTVNotifierprotected intprotected Stringprotected Stringprotected UUIDprotected Objectstatic final Objectstatic final Objectstatic final Objectstatic final Objectstatic final Objectstatic final Objectstatic final Objectstatic final ObjectFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Terminate this session; close connection and release resourcesprotected voidintintReturns the keepalive task handler.getLinkAt(int index) Returns the notifier object if any.getPortAt(int index) This function returns the status of the session.Returns the notifier object if any.voidhandleEvent(LTV event) Handles an IPC event that was read off the pipelinevoidhandleKeepAlive(LTV msg) Handler for receiving KeepAliveLTVs.protected voidvoidPasses non return value LTVs to the LTVNotifier if it exists.voidhandleMuMessage(LTV msg) Handles Multiuser messagesprotected voidvoidNotifies the keepalive notifier object of a timeoutbooleanA convenience method to test if the underlying connection is connectedbooleanThis function will return getSessionStatus() == STATUS_IPC_READY.booleanThis function will return getSessionStatus() == STATUS_MU_READY.booleanpipeline()booleanError handler for Packet Tracer Read Worker thread.voidvoidremoveLink(MULink link) voidrun()intvoidRegisters your LTVNotifier object with this session.voidRegisters your KeepAliveExpireNotifier object with this session.timer()voidupdateLink(MULink link) voidPasses off the tlv to the pipeline and does not wait for a responsePasses off the tlv to the pipeline and waits for a responseMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
isShutdown
protected boolean isShutdown -
readErrorCount
protected int readErrorCount -
localNetwork
-
remoteUsername
-
remoteNetwork
-
remoteUUID
-
muEventManager
-
links
-
availablePorts
-
keepAliveTask
-
notifier
-
sessionStatus
-
kn
-
STATUS_NETWORK_DISCONNECTED
-
STATUS_NETWORK_CONNECTED
-
STATUS_NEGOTIATING
-
STATUS_NEGOTIATION_SUCCESSFUL
-
STATUS_NEGOTIATION_FAILED
-
STATUS_AUTHENTICATION_FAILED
-
STATUS_AUTHENTICATION_SUCCESSFUL
-
STATUS_MU_READY
-
-
Constructor Details
-
MUSessionImpl
- Parameters:
host- Stringport- intcnp- properties- Throws:
IOException- exception
-
-
Method Details
-
run
public void run() -
registerEventManager
-
close
Description copied from interface:PacketTracerSessionTerminate this session; close connection and release resources- Specified by:
closein interfacePacketTracerSession- Throws:
IOException- problem with connection
-
emergencyShutdown
protected void emergencyShutdown() -
readWorkerError
Description copied from interface:PacketTracerSessionError handler for Packet Tracer Read Worker thread. Thrown when too many errors accumulate- Specified by:
readWorkerErrorin interfacePacketTracerSession- Parameters:
t- The thrown object.- Returns:
- boolean whether it was properly handled
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacePacketTracerSession
-
getEventManager
- Specified by:
getEventManagerin interfacePacketTracerSession- Returns:
- IPCEventManager the session's event manager
-
connection
- Specified by:
connectionin interfacePacketTracerSession- Returns:
- PacketTracerConnection the underlying PT connection
-
pipeline
- Specified by:
pipelinein interfacePacketTracerSession- Returns:
- Pipeline the data pipeline and associated filters
-
timer
- Specified by:
timerin interfacePacketTracerSession- Returns:
- Timer the keepalive timer
-
isConnected
public boolean isConnected()Description copied from interface:PacketTracerSessionA convenience method to test if the underlying connection is connected- Specified by:
isConnectedin interfacePacketTracerSession- Returns:
- boolean is pt connected
-
write
Description copied from interface:PacketTracerSessionPasses off the tlv to the pipeline and does not wait for a response- Specified by:
writein interfacePacketTracerSession- Parameters:
tlv- - the tlv to write- Throws:
IOException- problem with connection
-
sendPdu
- Throws:
IOException
-
writeRead
Description copied from interface:PacketTracerSessionPasses off the tlv to the pipeline and waits for a response- Specified by:
writeReadin interfacePacketTracerSession- Parameters:
tlv- - the tlv to write- Returns:
- the tlv returned from PT
- Throws:
IOException- problem with connection
-
handleEvent
Description copied from interface:PacketTracerSessionHandles an IPC event that was read off the pipeline- Specified by:
handleEventin interfacePacketTracerSession- Parameters:
event- The event LTV
-
handleMuMessage
Description copied from interface:PacketTracerSessionHandles Multiuser messages- Specified by:
handleMuMessagein interfacePacketTracerSession- Parameters:
msg- The mu message
-
addLink
- Throws:
Exception
-
removeLink
- Throws:
Exception
-
updateLink
- Throws:
Exception
-
handlePortAdvertisement
-
getPortAt
- Throws:
Exception
-
getAvailablePortCount
public int getAvailablePortCount() -
getLinkAt
- Throws:
Exception
-
getAvailableLinkCount
public int getAvailableLinkCount() -
processLinkUpdate
-
handleLinkUpdate
-
getKeepAliveTask
Description copied from interface:PacketTracerSessionReturns the keepalive task handler.- Specified by:
getKeepAliveTaskin interfacePacketTracerSession- Returns:
- KeepAliveTask The keepalive task handler.
-
handleKeepAlive
Description copied from interface:PacketTracerSessionHandler for receiving KeepAliveLTVs. Refreshes the counter.- Specified by:
handleKeepAlivein interfacePacketTracerSession- Parameters:
msg- LTV
-
handleLTV
Description copied from interface:PacketTracerSessionPasses non return value LTVs to the LTVNotifier if it exists.- Specified by:
handleLTVin interfacePacketTracerSession- Parameters:
msg- The KeepAliveLTV object.
-
setNotifier
Description copied from interface:PacketTracerSessionRegisters your LTVNotifier object with this session.- Specified by:
setNotifierin interfacePacketTracerSession- Parameters:
n- The LTVNotifier object.
-
getNotifier
Description copied from interface:PacketTracerSessionReturns the notifier object if any.- Specified by:
getNotifierin interfacePacketTracerSession- Returns:
- LTVNotifier the registered notifier object
-
isIpcReady
public boolean isIpcReady()Description copied from interface:PacketTracerSessionThis function will return getSessionStatus() == STATUS_IPC_READY.- Specified by:
isIpcReadyin interfacePacketTracerSession- Returns:
- boolean Boolean value of whether the IPC is ready to accept messages.
-
isMuReady
public boolean isMuReady()Description copied from interface:PacketTracerSessionThis function will return getSessionStatus() == STATUS_MU_READY.- Specified by:
isMuReadyin interfacePacketTracerSession- Returns:
- boolean Boolean value of whether the Multiuser connection is ready to accept messages.
-
getSessionStatus
Description copied from interface:PacketTracerSessionThis function returns the status of the session.- Specified by:
getSessionStatusin interfacePacketTracerSession- Returns:
- Object The session status object.
-
handleTimeout
public void handleTimeout()Description copied from interface:PacketTracerSessionNotifies the keepalive notifier object of a timeout- Specified by:
handleTimeoutin interfacePacketTracerSession
-
setTimeoutNotifier
Description copied from interface:PacketTracerSessionRegisters your KeepAliveExpireNotifier object with this session.- Specified by:
setTimeoutNotifierin interfacePacketTracerSession- Parameters:
n- The KeepAliveExpireNotifier object.
-
getTimeoutNotifier
Description copied from interface:PacketTracerSessionReturns the notifier object if any.- Specified by:
getTimeoutNotifierin interfacePacketTracerSession- Returns:
- KeepAliveExpireNotifier the registered notifier object
-